package com.exam.baidu;

import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution001 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] nums = new int[K];
        for (int i = 1; i <= K; i++) {
            nums[i - 1] = N * i;
        }
        int res = 0;
        for (int i = 0; i < K; i++) {
            String str = String.valueOf(nums[i]);
            StringBuilder sb = new StringBuilder(str);
            sb.reverse();
            while(sb.charAt(0) == '0'){
                sb.deleteCharAt(0);
            }
            nums[i] = Integer.parseInt(sb.toString());
            res = Math.max(res, nums[i]);
        }
        System.out.println(res);

    }
}
